import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:flutter_demo/core/model/category_model.dart';

class JsonParse {
  static Future<List<CategoryModel>> getCategoryData () async {
    final jsonString = await rootBundle.loadString("assets/json/category.json");

    final dataList = json.decode(jsonString)["category"];

    List<CategoryModel> category = [];
    for (var json in dataList) {
      category.add(CategoryModel.fromJson(json));
    }

    return category;
  }
}